# Contributor: Chloe Kudryavtsev <code@toast.bunkerlabs.net>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=sd
pkgver=1.0.0
pkgrel=0
pkgdesc="An intuitive find & replace CLI"
url="https://github.com/chmln/sd"
arch="all"
license="MIT"
options="net"
makedepends="cargo cargo-auditable"
source="$pkgname-$pkgver.tar.gz::https://github.com/chmln/sd/archive/v$pkgver.tar.gz"
subpackages="$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"

export CARGO_HOME="$srcdir"/cargo

build() {
	cargo auditable build \
		--release \
		--verbose
}

check() {
	cargo test --all \
		--release \
		--verbose
}

package() {
	install -Dm755 target/release/"$pkgname" "$pkgdir"/usr/bin/"$pkgname"

	# doc
	install -Dm644 gen/sd.1 -t "$pkgdir"/usr/share/man/man1

	# comp
	install -Dm644 gen/completions/sd.bash "$pkgdir"/usr/share/bash-completion/completions/sd
	install -Dm644 gen/completions/sd.fish "$pkgdir"/usr/share/fish/vendor_completions.d/sd.fish
	install -Dm644 gen/completions/_sd "$pkgdir"/usr/share/zsh/site-functions/_sd
}

sha512sums="
33ffbbaeb4d3829a231e3e0b9d8b3f07443a708aef46d976139329466b06038b3e83ecaf57c69df89ad5dc9528f7a54f678fc7081e015db9c00dd381323ed7a5  sd-1.0.0.tar.gz
"
